From 6141bfaa4256a23fca22e3d4fa718be66b11fa20 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 11 Jun 2014 04:08:27 +0000 Subject: [PATCH] Add our own setMSecsSinceEpoch() in gpsbabel::DateTime() --- gpsbabel/src/core/datetime.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gpsbabel/src/core/datetime.h b/gpsbabel/src/core/datetime.h index 55051ae0b..d79096865 100644 --- a/gpsbabel/src/core/datetime.h +++ b/gpsbabel/src/core/datetime.h @@ -94,6 +94,14 @@ public: return -msecsTo(epoch); } + // This was added in Qt 4.7, but it's easy enough to knock out here. + void setMSecsSinceEpoch(qint64 msecs) { + int ddays = msecs / 86400000; + msecs %= 86400000; + setDate(QDate(1970, 1, 1).addDays(ddays)); + setTime(QTime(0,0).addMSecs(msecs)); + } + // Like toString, but with subsecond time that's included only when // the trailing digits aren't .000. Always UTC. QString toPrettyString() const { -- 2.30.2